<?php
function ListAllProduct($idP=0)
{
    global $dbsql,$language;
    
    $sql_where  = " from tblproduct where cLanguage='$language' and iStatus=1 ";
    if($idP>0)
    {
        $sql_where  .= " and iParentId=$idP ";
    }
    $sql_select = "select count(iId) as count ".$sql_where;
    $result     = $dbsql->query_fetch($sql_select);
    $countall   = $result['count'];
    
    list($lf,$la)= Split_Page($countall);
    
    $sql_select = "select * ".$sql_where." order by iOrder limit $lf,$la";
    return $dbsql->load($sql_select);
}

function getLinkCatProduct($id)
{
    global $dbsql,$language;
    
    $sql_select = "select cUrlString,iParentId from tblproduct_category where iId=$id";
    $result     = $dbsql->query_fetch($sql_select);
    if($result['iParentId']>0)
    {
        $urlP   = getLinkCatProduct($result['iParentId']);
    }
    return $urlP.$result['cUrlString'].'/';
}

?>